<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>就诊管理</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="${pageContext.request.contextPath}/back/css/x-admin.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/back/css/pag.css" media="all">
<link rel="stylesheet" href="${pageContext.request.contextPath}/assets/layui/css/layui.css" media="all"> 
<link href="${pageContext.request.contextPath}/back/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/layer/layer.js"></script> 
<script src="${pageContext.request.contextPath}/back/lib/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
	<div class="x-nav">
		<span class="layui-breadcrumb"> <a><cite>首页</cite></a> <a><cite>就诊管理</cite></a>
		</span> <a class="layui-btn layui-btn-small"
			style="line-height: 1.6em; margin-top: 3px; float: right"
			href="javascript:location.replace(location.href);" title="刷新"><i
			class="layui-icon" style="line-height: 30px">ဂ</i></a>
	</div>
	<div class="x-body">
		<form class="layui-form x-center" action="" style="width: 85%">
			<div class="layui-form-pane">
				<div class="layui-form-item">
					<label class="layui-form-label">姓名</label>
					<div class="layui-input-inline" style="width: 100px">
						<input type="text" name="name" placeholder="姓名" autocomplete="off"
							class="layui-input">
					</div>
					<div class="layui-input-inline" style="width: 200px">
						<input type="text" name="link" placeholder="搜索" autocomplete="off"
							class="layui-input">
					</div>
					<div class="layui-input-inline" style="width: 80px">
						<button class="layui-btn" lay-submit="" lay-filter="*">搜索</button>
					</div>
				</div>
			</div>
		</form>
		<table class="tablelist">
			<thead>
				<tr>
					<th><input onclick="selectAll()" type="checkbox"
						name="controlAll" style="" id="controlAll"></th>
					<th>编号</th>
					<th>病人</th>
					<th>医生</th>
					<th>部门</th>
					<th>病人病史</th>
				</tr>
			</thead>
			<tbody>
			<c:if test="${medicalHistory==null}">
				<jsp:forward page="../selectMedicalHistory"></jsp:forward>
			</c:if>
			
			<c:forEach items="${medicalHistory}" var="medicalHistory">
				<tr>
					<td><input type="checkbox" value="1" name="selected">
					</td>
					<td>${medicalHistory.patientSituationId}</td>
					<td>${medicalHistory.patientname}</td>
					<td>${medicalHistory.doctorname}</td>
					<td>${medicalHistory.outpatientservicetypename}</td>
					<td>${medicalHistory.diseaseName}</td>
				</tr>
				</c:forEach>
			</tbody>
		</table>
		<div id="pageDiv" style="text-align: center"></div>
		<!-- <div class="page" v-show="show">
			<div class="pagelist">
				<span class="jump">上一页</span> <span class="jump">1</span> <span
					class="jump">2</span> <span class="jump">3</span> <span
					class="jump">4</span> <span class="jump">5</span> <span
					class="jump">6</span> <span class="ellipsis">...</span> <span
					class="jump">下一页</span> <span class="jumppoint">跳转到：</span> <span
					class="jumpinp"> <input type="text">
				</span> <span class="jump gobtn">GO</span>
			</div>
		</div> -->
	</div>
	<br />
	<br />
	<br />
<!-- 	<script src="./lib/layui/layui.js" charset="utf-8"></script>
	<script src="./js/x-layui.js" charset="utf-8"></script>
	<script src="js/jquery2.js" charset="utf-8"></script>
	<script src="js/js.js" charset="utf-8"></script> -->
	<!-- 分页操作 -->
	<link rel="stylesheet" href="${pageContext.request.contextPath}/assets/layui/css/layui.css" media="all"> 
 		<script src="${pageContext.request.contextPath}/assets/layui/layui.js" charset="utf-8"></script> 
	<script type="text/javascript">
		$(function(){
			  layui.use(['laypage', 'layer'], function(){
				  var laypage = layui.laypage
				  ,layer = layui.layer;
				
				//完整功能
				  laypage.render({
				    elem: 'pageDiv'
				    ,count: ${requestScope.count}
				    ,curr:${requestScope.page}
				    ,limit:10
				    ,layout: ['count', 'prev', 'page','limit','next', 'skip']
				    ,jump: function(obj,first){
				    //首次不执行
				      if(!first){
				    	  $.ajax({
				    		  url:"${pageContext.request.contextPath}/selectMedicalHistoryPage/"+obj.curr+"/"+obj.limit,
				    		  type:"get",
				    		  success:function(medicalHistory){
				    			  console.log(medicalHistory.length);
				    			 		$("tbody").empty();
				    				      //模拟渲染
				    				      var innerHtml="";
				    				     
				    				      $.each(medicalHistory,function(index,medicine){
				    				    	  innerHtml+="<tr>"+
				    				    	  "<td><input onclick='selectAll()'"+" type='checkbox'"+
			    								"name='controlAll'"+"id='controlAll'></td>"+
			    								"<td>"+medicine.patientSituationId+"</td>"+
			    								"<td>"+medicine.patientname+"</td>"+
			    								"<td>"+medicine.doctorname+"</td>"+
			    								"<td>"+medicine.outpatientservicetypename+"</td>"+
			    								"<td>"+medicine.diseaseName+"</td>"+
			    								"</tr>";
				    				      })
				    				      
				    				     $("tbody").html(innerHtml);
				    				    }
				    				  });
				    		  }
				    	  }
				  });
				}); 
		});
		 
	</script> 
	
</body>
</html>